import sys
from PyQt5.QtWidgets import QApplication,QWidget
from PyQt5.Qt import QLineEdit,QPushButton,QLabel,QObject

class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.resize(600,400)
        self.setWindowTitle("垃圾识别")
        self.move(100,100)

        obj1 = QObject()
        obj1.setObjectName('qq121')
        obj1.setProperty('index',1)
        obj2 = QObject()
        obj2.setObjectName('qq122')
        obj2.setProperty('index', 2)
        obj3 = QObject()
        obj3.setObjectName('qq123')
        obj3.setProperty('index', 3)
        obj4 = QObject()
        obj4.setObjectName('qq124')
        # print('obj1',obj1)
        obj2.setParent(obj1)
        obj3.setParent(obj1)
        print(obj2,obj3)
        obj2.setParent(obj4)
        print('obj1.children',obj1.children())
        print(obj2.objectName())
        print(obj2.property('index'))


        '''
        isWidgetType()
        inherits()       
        
        '''
if __name__=='__main__':
    app = QApplication(sys.argv)
    w = Window()

    print(w.isWidgetType())
    print(w.inherits('QLabel'))
    # obj1 = QObject()
    # print(obj1.isWidgetType())
    w.show()
    sys.exit(app.exec_())

